# # 显示 9 位，最后一位四舍五入
# result <- format(23.123456789, digits = 9)
# print(result)
#
# # 使用科学计数法显示
# result <- format(c(6, 13.14521), scientific = TRUE)
# print(result)
#
# # 小数点右边最小显示 5 位，没有的以 0 补充
# result <- format(23.47, nsmall = 5)
# print(result)
#
# # 将数字转为字符串
# result <- format(6)
# print(result)
#
# # 宽度为 6 位，不够的在开头添加空格
# result <- format(13.7, width = 6)
# print(result)
#
# # 左对齐字符串
# result <- format("Runoob", width = 9, justify = "l")
# print(result)
#
# # 居中显示
# result <- format("Runoob", width = 10, justify = "c")
# print(result)
#
# # 右对齐字符串
# result <- format("Runoob", width = 9, justify = "r")
# print(result)

# result <- nchar("Google Runoob Taobao")
# print(result)
#
# x = "dhwjhdkwjhdkHFGFGF"
# print(toupper(x))
# print(tolower(x))

# 四个随机数
random_integers <- sample(10:20, 4, replace = TRUE)

# 立方
cubes <- random_integers^3

# 立方根
cube_roots <- random_integers^(1/3)

# 创建矩阵
matrix_data <- cbind(random_integers, cubes, cube_roots)

rownames(matrix_data) <- c("x1", "x2", "x3","x4")
colnames(matrix_data) <- c("x", "x的立方", "x的立方根")

# 打印带有列名的矩阵
print(matrix_data)
